﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Converters="clr-namespace:Elysium.Theme.Converters"
                    xmlns:Root="clr-namespace:Elysium.Theme">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium.Theme;component/Themes/SharedResources.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="CommandButtonsBaseStyle" TargetType="{x:Type ButtonBase}">
        
        <Setter Property="Background" Value="{StaticResource Transparent}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ForegroundMiddlelight}"/>
        <Setter Property="BorderThickness" Value="{x:Static Root:Parameters.SemiboldThickness}"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundMiddlelight}"/>
        <Setter Property="FontFamily" Value="{x:Static Root:Parameters.FontFamily}"/>
        <Setter Property="FontSize" Value="{x:Static Root:Parameters.ContentFontSize}"/>
        <Setter Property="FontWeight" Value="SemiBold"/>

        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}"/>

        <Setter Property="Padding" Value="{x:Static Root:Parameters.BoldPadding}"/>
        
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Ellipse Fill="{TemplateBinding Background}"
                                 Stroke="{TemplateBinding BorderBrush}"
                                 StrokeThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static Converters:ThicknessToDoubleConverter.Instance}}"
                                 Stretch="Uniform"/>
                        <Ellipse Fill="{TemplateBinding Foreground}"
                                 Stroke="{StaticResource Transparent}"
                                 StrokeThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static Converters:ThicknessToDoubleConverter.Instance}}"
                                 Stretch="Uniform">
                            <Ellipse.OpacityMask>
                                <VisualBrush AutoLayoutContent="True"
                                             AlignmentX="Center"
                                             AlignmentY="Center"
                                             Stretch="None">
                                    <VisualBrush.Visual>
                                        <ContentPresenter Margin="{TemplateBinding Padding}"
                                                          RecognizesAccessKey="True"/>
                                    </VisualBrush.Visual>
                                </VisualBrush>
                            </Ellipse.OpacityMask>
                        </Ellipse>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource ForegroundLowlight}"/>
                <Setter Property="Foreground" Value="{StaticResource ForegroundLowlight}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource Foreground}"/>
                <Setter Property="Foreground" Value="{StaticResource Foreground}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource Disabled}"/>
                <Setter Property="Foreground" Value="{StaticResource Disabled}"/>
            </Trigger>
        </Style.Triggers>
        
    </Style>

</ResourceDictionary>